package com.eshop.web;

import com.eshop.web.page.AdminPage;
import com.eshop.web.page.SignInPage;
import com.eshop.web.page.UserPage;
import org.apache.wicket.Page;
import org.apache.wicket.authroles.authentication.AbstractAuthenticatedWebSession;
import org.apache.wicket.authroles.authentication.AuthenticatedWebApplication;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.eshop.web.page.IndexPage;

/**
 * Created by IntelliJ IDEA.
 * User: Sergey
 * Date: 17.10.13
 * Time: 0:29
 * To change this template use File | Settings | File Templates.
 */
public class ExampleApplication extends AuthenticatedWebApplication {
    private static final Logger LOGGER = LoggerFactory.getLogger(ExampleApplication.class);

    @Override
    protected void init() {
        super.init();    //To change body of overridden methods use File | Settings | File Templates.
        this.getComponentInstantiationListeners().add(new SpringComponentInjector(this));
        mount(new MountedMapperWithoutPageComponentInfo("/index", IndexPage.class));
        mount(new MountedMapperWithoutPageComponentInfo("/login", SignInPage.class));
        mount(new MountedMapperWithoutPageComponentInfo("/user", UserPage.class));
        mount(new MountedMapperWithoutPageComponentInfo("/admin", AdminPage.class));

        //FileSystemFolderRepository.get().mountAllResources();
        get().getMarkupSettings().setStripWicketTags(true);
    }

    @Override
    public Class<? extends Page> getHomePage() {
        return IndexPage.class;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    protected Class<? extends AbstractAuthenticatedWebSession> getWebSessionClass() {
        return MyAuthenticatedWebSession.class;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    protected Class<? extends WebPage> getSignInPageClass() {
        return SignInPage.class;  //To change body of implemented methods use File | Settings | File Templates.
    }




}
